import PageView from '@/components/page-view.vue';
import Layout from '@/components/layout/index.vue';
import { createRouter, createWebHistory } from 'vue-router';

export default createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/', // 使用动态导入来实现懒加载
      component: Layout,
      redirect: { path: '/welcome' },
      children: [
        {
          path: '/welcome',
          component: () => import('@/pages/welcom/index.vue'),
        },
        {
          path: '/system',
          component: PageView,
          children: [
            {
              path: '/system/account',
              component: () => import('@/pages/system/account/index.vue'),
              meta: {
                hideTab: true,
              },
            },
          ],
        },
      ],
    },
    {
      path: '/login',
      component: () => import('@/pages/login/index.vue'),
    },
    {
      //404页面捕获
      path: '/:pathMatch(.*)*',
      name: 'NotFound',
      meta: { type: 'err' },
      component: () => import('@/pages/exception/404.vue'),
    },
  ],
});
